EX_IDM    = ../../../test/ex_idm.sh
#PROFILER  = python -m cProfile 
PROFILER  = time
TRAIN_EXE = ./serial_som.py

# Correctness test params
C_DIM       = 10
C_TS_SIZE   = 10000
C_TDATA     = ~/mas/project/data/sparse_idm/id10_1000.dat
C_SIZE_X    = 100
C_SIZE_Y    = 100
C_SOM_INI   = c_som_ini.dat
C_SOM_FIN   = c_som_fin.dat
C_SHOW_PROG = 100
C_TEST_OUT  = c_test.out

# Grimm tales (semantic maps)
G_DIM       = 5302
#G_TS_SIZE   = 96577
G_TS_SIZE   = 1000
G_TDATA     = ~/mas/project/data/semap1/encdata.txt
G_SIZE_X    = 73
G_SIZE_Y    = 73
G_SOM_INI   = g_som_ini.dat
G_SOM_FIN   = g_som_fin.dat
G_SHOW_PROG = 1
G_TEST_OUT  = g_test.out

MIN_W     = 0
MAX_W     = 0.1
DEBUG     = 0

all: compile

compile:
	python compile.py build_ext --inplace

testc: $(TRAIN_EXE)
	$(PROFILER) $(TRAIN_EXE) $(C_DIM) $(C_TS_SIZE) $(C_TDATA) $(C_SIZE_X) $(C_SIZE_Y) $(MIN_W) $(MAX_W) $(C_SOM_INI) $(C_SOM_FIN) $(DEBUG) $(C_SHOW_PROG) > $(C_TEST_OUT) 2>&1
		$(EX_IDM) $(C_SOM_FIN) >> $(C_TEST_OUT)
	tail -$(C_DIM) $(C_TEST_OUT)

testg: $(TRAIN_EXE)
	$(PROFILER) $(TRAIN_EXE) $(G_DIM) $(G_TS_SIZE) $(G_TDATA) $(G_SIZE_X) $(G_SIZE_Y) $(MIN_W) $(MAX_W) $(G_SOM_INI) $(G_SOM_FIN) $(DEBUG) $(G_SHOW_PROG) > $(G_TEST_OUT) 2>&1
		$(EX_IDM) $(G_SOM_FIN) >> $(G_TEST_OUT)
	tail -$(G_DIM) $(G_TEST_OUT)

clean:
	rm -fr nohup.out *.pyc ./build *.so *.c __pycache__
	rm -f $(C_SOM_INI) $(C_SOM_FIN) $(C_TEST_OUT)
	rm -f $(G_SOM_INI) $(G_SOM_FIN) $(G_TEST_OUT)